#include "djirc.h"

/*----------------------------------------------------------------------------------------
函数名：void SetUartHandle(USART_TypeDef* USARTx)
功  能：给djirc模块设置串口，并初始化串口类
----------------------------------------------------------------------------------------*/
void DJIRC::SetUartHandle(USART_TypeDef* USARTx){
    usart_djirc->USART_RT.USARTx = USARTx;
    usart_djirc->USART_Init(DJI_RC_RECEIVE_SIZE,0,0,0x01);
}



void DJIRC::ChannelValueUpdate(void)
{
    m_rocker_value.right_level     = -((float)(channel.Ch0 - RC_CH_VALUE_OFFSET)) / (RC_CH_VALUE_MAX - RC_CH_VALUE_OFFSET);
    m_rocker_value.right_upright   = ((float)(channel.Ch1 - RC_CH_VALUE_OFFSET)) / (RC_CH_VALUE_MAX - RC_CH_VALUE_OFFSET);
    m_rocker_value.left_level      = -((float)(channel.Ch2 - RC_CH_VALUE_OFFSET)) / (RC_CH_VALUE_MAX - RC_CH_VALUE_OFFSET);
    m_rocker_value.left_upright    = ((float)(channel.Ch3 - RC_CH_VALUE_OFFSET)) / (RC_CH_VALUE_MAX - RC_CH_VALUE_OFFSET);
    m_rocker_value.knob            = -((float)(channel.Ch4 - RC_CH_VALUE_OFFSET)) / (RC_CH_VALUE_MAX - RC_CH_VALUE_OFFSET);
}